package domain;

public class ManagerIn {
    private TipoLinkIn link;
    
    private ManagerIn(TipoLinkIn link){
        this.link = link;
    }
    
    public TipoLinkIn getLink(){
        return link;
    }
    static void inserisci(TipoLinkIn link) {
        if(link != null &&
                !link.getRoot().getLinkIn().contains(link) &&
                link.getFile().getLinkIn() == null){
            ManagerIn manager = new ManagerIn(link);
            link.getRoot().inserisciPerManagerIn(manager);
            link.getFile().inserisciPerManagerIn(manager);
        }
            
    }

    static void elimina(TipoLinkIn link) {
        if(link != null &&
                link.getRoot().getLinkIn().contains(link) &&
                link.getFile().getLinkIn().equals(link)){
            ManagerIn manager = new ManagerIn(link);
            link.getRoot().eliminaPerManagerIn(manager);
            link.getFile().eliminaPerManagerIn(manager);
        }
    }
    
}
